//
//  PKproductMainListTableViewCell.m
//  PianKe
//
//  Created by mingtao on 15/9/26.
//  Copyright (c) 2015年 mingtao. All rights reserved.
//

#import "PKproductMainListTableViewCell.h"
#import <UIImageView+WebCache.h>

@implementation PKproductMainListTableViewCell



+(CGFloat)heightForcell
{
    return 300 *(WIHES-20)/608+10+40;

}



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _mainImageView = [[UIImageView alloc]init];
        
        _mainImageView.frame = CGRectMake(10, 10, WIHES-20, 300 *(WIHES-20)/608);
        
        [self.contentView addSubview:_mainImageView];
        
        CGFloat lbY = _mainImageView.frame.size.height+20;
        
        _titleLable = [[UILabel alloc]initWithFrame:CGRectMake(10, lbY, 200, 20)];
        
        [self.contentView addSubview:_titleLable];
        
        _buyButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        _buyButton.frame = CGRectMake(WIHES-90, lbY, 80, 30);
        
        [_buyButton setTitle:@"立即购买" forState:(UIControlStateNormal)];
        
        [self.contentView addSubview:_buyButton];
        
    }
    return self;
}



//重写setter方法，然后再setter内部给cell控件赋值
-(void)setConfigureModel:(PKproductMainListModel *)configureModel
{
    _configureModel = configureModel;
    
    [_mainImageView sd_setImageWithURL:[NSURL URLWithString:configureModel.coverimg]];
    
    _titleLable.text = configureModel.title;


}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
    
}

@end
